package com.astoolkit.workflow
{
   import flash.events.Event;
   
   import mx.rpc.Fault;

   public class WorkflowEvent extends Event
   {
	  public static const INITIALIZE : String = "initialize";
	  public static const STARTED : String = "started";
	  public static const PREPARE : String = "prepare";
	  public static const SUSPENDED : String = "suspended";
	  public static const RESUMED : String = "resumed";
      public static const FAULT : String = "fault";
      public static const COMPLETED : String = "completed";
      public static const WARNING : String = "warning";
	  public static const ABORT : String = "abort";
	  public static const PROGRESS : String = "progress";

	  private var _message : String = "";
	  private var _fault : Fault;
	  
	  private var _relatedTask : IWorkflowTask;
	  
      public function WorkflowEvent( inType : String, inRelatedTask : IWorkflowTask = null, inMessage : String = "", inFault : Fault = null)
      {
         super( inType );
         _message = inMessage;
		 _fault = inFault;
		 _relatedTask = inRelatedTask;
      }
            
	  public function get relatedTask() : IWorkflowTask
	  {
		  return _relatedTask;
	  }
	  
	  public function get message() : String
	  {
		  return _message;
	  }
	  
	  public function get fault() : Fault
	  {
		  return _fault;
	  }
	  
      override public function clone() : Event
      {
         return new WorkflowEvent( type, _relatedTask, _message, _fault );
      }
	  		  
   }
}